package com.ihr360.insurance.dao;

import com.ihr360.insurance.model.dto.staff.StaffBenefit;
import com.ihr360.rest.reposity.SimpleRestReposity;
import com.ihr360.type.StaffStatus;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

import java.util.Collection;
import java.util.List;

/**
 * @author Stone.Shi
 * @description
 * @date 2018-02-01 18:30:31.
 */
@RepositoryRestResource
public interface StaffBenefitReposity extends SimpleRestReposity<StaffBenefit, Long>, PagingAndSortingRepository<StaffBenefit, Long>,
        JpaSpecificationExecutor<StaffBenefit> {

    int countAllByCompanyIdAndSiCompanyBenefitIdInAndStaffStaffStatusAndStaffIdIn(
            String companyId, Collection<Long> siCompanyBenefitIds, StaffStatus staffStatus, List<String> staffIds);

    int countAllByCompanyIdAndHfCompanyBenefitIdInAndStaffStaffStatusAndStaffIdIn(
            String companyId, Collection<Long> hfCompanyBenefitIds, StaffStatus staffStatus, List<String> staffIds);

    int countAllByCompanyIdAndSiCompanyBenefitIdInAndStaffIdIn(String companyId, Collection<Long> siCompanyBenefitIds, List<String> staffIds);

    int countAllByCompanyIdAndHfCompanyBenefitIdInAndStaffIdIn(String companyId, Collection<Long> hfCompanyBenefitIds, List<String> staffIds);

    int countAllBySiCompanyBenefitIdAndStaffIdIn(Long siCompanyBenefitId, List<String> staffIds);

    int countAllByHfCompanyBenefitIdAndStaffIdIn(Long hfCompanyBenefitId, List<String> staffIds);

    List<StaffBenefit> findAllByCompanyIdAndStaffIdIn(String companyId, List<String> staffIds);

    StaffBenefit findByCompanyIdAndStaffId(String companyId, String staffId);

}
